//
//  MemberCenterViewModel.m
//  yanyi
//
//  Created by dyy-ios4 on 2023/6/21.
//

#import "MemberCenterViewModel.h"

@implementation MemberCenterViewModel
//
//+ (void)requestVipInfoCompletion:(void (^)(YRVipMessageModel * model, BOOL success, NSString *errorMessage))completion {
//    
////    [YYNetworkManager pushDataToServer:requestVipInfoUrlString param:nil success:^(int code, id  _Nonnull info, NSString * _Nonnull msg) {
////        NSDictionary *firstDictionray = [(NSArray *)info firstObject];
////        YRVipMessageModel *model = [YRVipMessageModel modelWithDictionary:firstDictionray];
////        completion(model, code == 0, msg);
////    } error:^{
////        completion(nil, NO, @"网络请求失败");
////    }];
//}

//MARK: 请求vip 权限
//+ (void)requestVipRightCompletion:(void (^)(NSArray < YRVipRightModel *> * modelArray, BOOL success, NSString *errorMessage))completion {
////    [YYNetworkManager pushV2DataToServer:requestVipRightString param:nil success:^(int code, id  _Nonnull info, NSString * _Nonnull msg) {
////        NSArray *array = [NSArray modelArrayWithClass:[YRVipRightModel class] json:info];
////        completion(array, code == 0, msg);
////    } error:^{
////        completion(nil, NO, @"网络请求失败");
////    }];
//}

+ (void)confirmBuyResultWithreceiptData:(NSString *)receiptData orderNumber:(NSString *)orderNumber Completion:(void (^)(NSObject * model, BOOL success, NSString *errorMessage))completion {
    
//
//    NSDictionary *param = @{@"receipt-data":receiptData,@"order_sn":orderNumber};
//    [[RQHttpClient shareClient] requestWithPath:@"/api/v1/member/payResult" params:param httpMethod:RQHttpRequestPost sucess:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
//        NSDictionary * dict = [responseObject mj_JSONObject];
//               
//        if (dict[ResultCode_Key] && [dict[ResultCode_Key] integerValue] == Result_Success) {
//            completion(nil, YES, nil);
//        } else {
//            completion(nil, NO, @"验证失败 请稍后再试");
//        }
//    } failture:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
//        completion(nil, NO, @"验证失败 请稍后再试");
//    }];

}

+ (void)confirmRechargeResultWithreceiptData:(NSString *)receiptData orderNumber:(NSString *)orderNumber rechargeID:(NSString *)rechargeID Completion:(void (^)(NSObject * model, BOOL success, NSString *errorMessage))completion {
    NSString *type = @"";
    if ([rechargeID isEqualToString:@"aivideo_recharge_07"]) {
        type = @"week";
    } else {
        type = @"year";
    }
    NSDictionary *param = @{
//        @"aivideo_recharge" : rechargeID,
                            @"receipt" : receiptData,
                            @"trade_no":orderNumber,
                            @"type":type
    };
    [[DCHttpClient shareClient] requestWithPath:@"/api/diamond.diamond/vipBuy" params:param httpMethod:DCHttpRequestPost sucess:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        NSDictionary * dict = [responseObject mj_JSONObject];
        if([dict[@"code"] intValue]==1){
            completion(nil, YES, nil);
        } else {
            completion(nil, NO, @"验证失败 请稍后再试");
        }
    } failture:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
        completion(nil, NO, @"验证失败 请稍后再试");
    }];

}

//+ (void)requestAppleEachangeOrderNumberVipId:(NSString *)vipID money:(NSString *)money Completion:(void (^)(NSArray < YROrderNumberModel *> * modelArray, BOOL success, NSString *errorMessage))completion {
////    NSDictionary *params = @{
////        @"vipid": vipID ? vipID : @"",
////        @"money" : money ? money : @""
////    };
//    
////    [YYNetworkManager pushDataToServer:requestAppleBuyOrderNumber param:params success:^(int code, id  _Nonnull info, NSString * _Nonnull msg) {
////        NSArray *array = [NSArray modelArrayWithClass:[YROrderNumberModel class] json:info];
////        completion(array, code == 0, msg);
////    } error:^{
////        completion(nil, NO, @"网络请求失败");
////    }];
//    
//}

//+ (void)requestAppleRechargeOrderNumberVipId:(NSString *)rechargeId money:(NSString *)money coin:(NSString *)coin Completion:(void (^)(NSArray < YROrderNumberModel *> * modelArray, BOOL success, NSString *errorMessage))completion {
////    NSDictionary *params = @{
////        @"changeid": rechargeId ? rechargeId : @"",
////        @"money" : money ? money : @"",
////        @"coin" : coin ? coin : @""
////    };
////    
////    [YYNetworkManager pushDataToServer:requestAppleBuyRechargeOrderNumber param:params success:^(int code, id  _Nonnull info, NSString * _Nonnull msg) {
////        NSArray *array = [NSArray modelArrayWithClass:[YROrderNumberModel class] json:info];
////        completion(array, code == 0, msg);
////    } error:^{
////        completion(nil, NO, @"网络请求失败");
////    }];
//}


@end
